---
title: Agentica > Guide Documents > Concepts > Document Driven Development
---
import { Tabs } from "nextra/components";

import RemoteSource from "../../../components/RemoteSource";

import ShoppingSaleControllerSnippet from "../../snippets/ShoppingSaleControllerSnippet.mdx";
import BbsArticleServiceSnippet from "../../snippets/BbsArticleServiceSnippet.mdx";
import IBbsArticleSnippet from "../../snippets/IBbsArticleSnippet.mdx";
import LlmApplicationExampleSnippet from "../../snippets/LlmApplicationExampleSnippet.mdx";

import DocumentationStrategyDtoDescriptionSnippet from "../../snippets/DocumentationStrategyDtoDescriptionSnippet.mdx";
import DocumentationStrategyPropertyDescriptionSnippet from "../../snippets/DocumentationStrategyPropertyDescriptionSnippet.mdx";
import DocumentationStrategyNamespaceSnippet from "../../snippets/DocumentationStrategyNamespaceSnippet.mdx";
import { YoutubeRenderer } from "../../../components/YoutubeRenderer";

## Preface
### Agent Workflow Problem
![Agent Workflow Example](/images/docs/concepts/agent-workflow-example.png)

In the traditional agent development method, whenever the agent's functionality is expanded, AI developers had drawn more and more complex agent workflows and graphs. However, no matter how complex the workflow graph is drawn, the accuracy of the agent has been significantly reduced as the functionality has expanded.

It's because whenever a new node is added to the agent graph, the number of processes to go through increases, and the success rate decreases as a Cartesian Product by the number of processes. For example, if five agent nodes are sequentially listed up, and each node has a 80 % success rate, the final success rate becomes 32.77 % (0.8<sup>5</sup>).

To hedge the Cartesian Product of success rate, AI developers need to construct a much more complex graph to independently partition each event. This inevitably makes AI agent development difficult and makes it difficult to respond to changing requirements, such as adding or modifying new features.

### Document Driven Development
Here I propose a new paradigm; "Document Driven Development".

Take every responsibilities to the LLM (Large Language Model) function calling. And you just concentrate on documentation (comment) for each function independently. Then the success rate would be independent for each function, so that the cartesian product to success rate would not be applied. Also, since you only need to adjust the list of functions to be called, you can develop more flexibly and quickly than any other methodology.

I call this new paradigm as "Document Driven Development", and recommend to combine with the [Compiler Driven Development](/docs/concepts/compiler-driven-development). Just believe `@agentica`, and give up drawing complex agent graphs (workflows). You just concentrate on documentation for each function. `@agentica` and LLM function calling will fully take care of the rest.

### Demonstration of Efficiency
<br/>
<YoutubeRenderer src="https://www.youtube.com/embed/RAzYo02HTXA" type="shorts"/>


  - Github Repository: https://github.com/samchon/shopping-backend
  - Architecture: [Entity Relationship Diagram](https://github.com/samchon/shopping-backend/blob/master/docs/ERD.md)
  - Swagger UI: https://shopping-be.wrtn.ai/editor
  - Playground: https://wrtnlabs.io/agentica/playground/shopping/

Shopping backend server project for enterprise level chatbot demonstration.

[`@samchon/shopping-backend`](https://github.com/samchon/shopping-backend) is a shopping mall backend server project consisting of a total of 289 API functions which can cover most features of e-commerce. It supports authentication, product managenent, order purchasing, delivery tracking, discount coupon, deposit and withdrawal, and so on.

`@samchon/shopping-backend` is a typical project that can never be achieved with the traditional agent development way utilizing agent workflow graphs. Will you draw infinite number of agent workflows, or just document each function? Will you re-draw the infinite number of agent workflows whenever a new feature is added, or just add a new function with documentation comment?

`@samchon/shopping-backend` shows how "Document Driven Development" is effective in the AI agent development. Only the [Compiler Driven Development](/docs/concepts/compiler-driven-development) and "Document Driven Development" methodologies can accomplish such enterprise level AI agent development. Make it easily and safely with `@agentica`.




## Functional Documentation
### Description Comment
<BbsArticleServiceSnippet />

Describe for proper function selecting.

When writing description comment on each function, describe only about purpose of the function, concentrating on how to induce the agent to properly select the function during the conversation. Don't describe about its DTO like parameters or return types.

It's because `@agentica` has separated the candidate function selecting process and arguments filling of the selected function process independently in its [internal agents' orchestration](/docs/concepts/function-calling/#orchestration-strategy). Also, description of the function is restricted to maximum 1,023 characters in the LLM providers like OpenAI. Therefore, no need to describe abouot DTO in the description comment written on the function.

### Dependency Relationship
<ShoppingSaleControllerSnippet />

Dependency relationship, also writes in the description comment.

If there're some functions that should be called before or after the function, describe the dependency relationship in the description comment. If the LLM function calling schema comes from a TypeScript class, then refer the target function name. Otherwise the function comes from the backend server, refer the target function's method and name.

For example, in the demonstration project [`@samchon/shopping-backend`](https://github.com/samchon/shopping-backend), there are two functions `shoppings.sales.index` and `shoppings.sales.at`. The first function lists up all sales in the market with summarized information, and the seconnd function shows the detailed information of a specific sale. To describe such dependency relationship, [`ShoppingSaleController`](https://github.com/samchon/shopping-backend/blob/master/src/controllers/shoppings/base/sales/ShoppingSaleController.ts)'s description comment is written as above. 

### Selection Benchmark
Benchmark your documentation quality.

When you've completed documentation for all functions, benchmark your documentation quality by function select benchmark of [`@agentica/benchmark`](/docs/plugins/benchmark) module. Rather than testing the documentation quality by yourself by running AI chatbot manually, making benchmark program is much more effective.

In the [`@samchon/shopping-backend`](https://github.com/samchon/shopping-backend) project, it has measured documentation quality by below user prompt. And in the benchmark, success rate of function selecting was always 100 %.

> I wanna see every sales in the shopping mall
> 
> And then show me the detailed information about the Macbook.
> 
> After that, select the most expensive stock from the Macbook, and put it into my shopping cart. And take the shopping cart to the order.
> 
> At last, I'll publish it by cash payment, and my address is
> 
>   - country: South Korea
>   - city/province: Seoul
>   - department: Wrtn Apartment
>   - Possession: 101-1411




## Schema Documentation
### DTO Description
<DocumentationStrategyDtoDescriptionSnippet />

### Property Description
<DocumentationStrategyPropertyDescriptionSnippet />

### Namespace Strategy
<DocumentationStrategyNamespaceSnippet />




## Domain Driven Development
Document Driven Development is the AI agent ​​version of Domain Driven Development.

There's a development methodology called "Domain Driven Development". It separates complicate project to small domains, and concentrate on each domain independently. It's because the complexity of the project is not from the project itself, but from the interaction between domains.

And such Domain Driven Development approach is also applied to the AI agent development, and I call it as "Document Driven Development". In fact, Document driven development is a pun on the AI ​​agent word for Domain Driven Development.

Let's separate the agent's functionality into small functions, and concentrate on each function independently. Then, the complexity of the agent will be reduced, and the success rate will be independent for each function. It's the same as the Domain Driven Development methodology.